<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>路程时间</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/member/route/memberRouteList.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline">
                                <label class="search-form-lable">路线名称</label>
                                <div class="layui-input-inline">
                                    <select name="routeId">
                                        <c:forEach var="route" items="${cRouteList}">
                                            <option value="${route.id}" ${input.routeId == route.id ? 'selected="selected"' : ''}>${route.routeName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </li>
                            <c:if test="${!isChild || isXzgsAdmin}">
                                <li class="form-item-inline"><label class="search-form-lable">所属机构</label>
                                    <div class="layui-input-inline">
                                        <select name="memberGroupId">
                                            <option value="">全部</option>
                                            <c:forEach var="memberGroup" items="${memberGroupList}">
                                                <option value="${memberGroup.id}" ${input.memberGroupId == memberGroup.id ? 'selected="selected"' : ''}>${memberGroup.realname}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </li>
                            </c:if>
                            <li class="form-item-inline">
                                <label class="search-form-lable">昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="nickName" autocomplete="off" class="layui-input"
                                           value="${input.nickName}" placeholder="请输入查询昵称">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">


                            <li class="form-item">
                                <label class="search-form-lable">地址位置</label>
                                <div class="check-btn-inner" id="addressType">
                                    <a id="allAddressType" href="javascript:void(0);"
                                       onclick="setTimeType($(this),'','#myForm')" ${empty input.addressType ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${input.addressType == 0 ? 'class="active"' : ''}>公司地址</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.addressType == 1 ? 'class="active"' : ''}>居住地址</a>
                                    <input type="hidden" name="addressType" value="${input.addressType}"/>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">

                            <li class="form-item">
                                <label class="search-form-lable">起始位置</label>
                                <div class="check-btn-inner" id="routeFlag">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),'','#myForm')" ${empty input.routeFlag ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${input.routeFlag == 0 ? 'class="active"' : ''}>路线起点</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.routeFlag == 1 ? 'class="active"' : ''}>路线终点</a>
                                    <input type="hidden" name="routeFlag" value="${input.routeFlag}"/>
                                </div>
                            </li>

                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item">
                                <label class="search-form-lable">出行方式</label>
                                <div class="check-btn-inner" id="travelType">
                                    <a id="allTravelType" href="javascript:void(0);"
                                       onclick="setTimeType($(this),'','#myForm')" ${empty input.travelType ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${input.travelType == 0 ? 'class="active"' : ''}>公交</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.travelType == 1 ? 'class="active"' : ''}>驾驶</a>
                                    <input type="hidden" name="travelType" value="${input.travelType}"/>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content">
                <div class="cl">
                    <table class="layui-table" lay-size="sm">
                        <thead>
                        <tr>
                            <th rowspan="2">序号</th>
                            <th rowspan="2">昵称</th>
                            <th rowspan="2">路线</th>
                            <th rowspan="2">起始位置</th>
                            <th rowspan="2">终点位置</th>
                            <c:if test="${null == input.travelType}">
                                <th colspan="2" style="text-align: center">驾车</th>
                                <th colspan="2" style="text-align: center">公交</th>
                            </c:if>
                            <c:if test="${null != input.travelType && input.travelType == 1}">
                                <th colspan="2" style="text-align: center">驾车</th>
                            </c:if>
                            <c:if test="${null != input.travelType && input.travelType == 0}">
                                <th colspan="2" style="text-align: center">公交</th>
                            </c:if>
                        </tr>
                        <tr>
                            <c:if test="${null == input.travelType}">
                                <th>路程距离</th>
                                <th>路程时间</th>
                                <th>路程距离</th>
                                <th>路程时间</th>
                            </c:if>
                            <c:if test="${null != input.travelType}">
                                <th>路程距离</th>
                                <th>路程时间</th>
                            </c:if>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="routeInfo" items="${routeInfoList}" varStatus="status">
                            <%--<tr>
                                <td rowspan="5">1</td>
                                <td rowspan="5">2222</td>

                            </tr>
                            <c:forEach begin="1" end="4">
                                <tr>
                                    <td>a</td>
                                    <td>b</td>
                                    <td>c</td>
                                    <td>d</td>

                                    <td>31</td>
                                    <td>32</td>
                                    <td>33</td>
                                    <td>34</td>
                                    <td>35</td>
                                </tr>
                            </c:forEach>--%>


                            <tr class="detail-content1">
                                <td rowspan="${fn:length(routeInfo.dataList) + 1}" style="width: 70px">${page.limit * (page.page-1) + status.count}</td>
                                <td rowspan="${fn:length(routeInfo.dataList) + 1}" style="width: 15%"><div>${routeInfo.memberName}</div></td>
                            </tr>
                            <c:forEach var="map" items="${routeInfo.dataList}">
                                <tr>
                                    <td style="width: 150px">
                                        <c:if test="${map.addressType == 1}">家</c:if>
                                        <c:if test="${map.addressType == 0}">公司</c:if>
                                        --->
                                        <c:if test="${map.routeFlag == 0}">起点</c:if>
                                        <c:if test="${map.routeFlag == 1}">终点</c:if>

                                    </td>
                                    <td style="width: 15%">
                                        <c:if test="${map.addressType == 0}">
                                            <div>${routeInfo.companyAddress}</div>
                                        </c:if>
                                        <c:if test="${map.addressType == 1}">
                                            <div>${routeInfo.homeAddress}</div>
                                        </c:if>
                                    </td>
                                    <td style="width: 15%">
                                        <c:if test="${map.routeFlag == 0}">
                                            <div>${routeInfo.origin}</div>
                                        </c:if>
                                        <c:if test="${map.routeFlag == 1}">
                                            <div>${routeInfo.destination}</div>
                                        </c:if>
                                    </td>
                                    <c:if test="${null == input.travelType}">
                                        <c:if test="${null != map.driver}">
                                            <td style="width: 100px">
                                                <c:if test="${map.driver.status == 0}">
                                                    <div>${map.driver.distance}km</div>
                                                </c:if>
                                                <c:if test="${map.driver.status == 1}">
                                                    <div>${map.driver.status}</div>
                                                </c:if>
                                            </td>
                                            <td style="width: 100px">
                                                <c:if test="${map.driver.status == 0}">
                                                    <div>${map.driver.duration}min</div>
                                                </c:if>
                                                <c:if test="${map.driver.status == 1}">
                                                    <div>${map.driver.message}</div>
                                                </c:if>
                                            </td>
                                        </c:if>
                                        <c:if test="${null == map.driver}">
                                            <td style="width: 100px"></td>
                                            <td style="width: 100px"></td>
                                        </c:if>

                                        <c:if test="${null != map.bus}">
                                            <td style="width: 100px">
                                                <c:if test="${map.bus.status == 0}">
                                                    <div>${map.bus.distance}km</div>
                                                </c:if>
                                                <c:if test="${map.bus.status != 0}">
                                                    <div>${map.bus.status}</div>
                                                </c:if>
                                            </td>
                                            <td style="width: 100px">
                                                <c:if test="${map.bus.status == 0}">
                                                    <div>${map.bus.duration}min</div>
                                                </c:if>
                                                <c:if test="${map.bus.status != 0}">
                                                    <div>${map.bus.message}</div>
                                                </c:if>
                                            </td>
                                        </c:if>
                                        <c:if test="${null == map.bus}">
                                            <td style="width: 100px"></td>
                                            <td style="width: 100px"></td>
                                        </c:if>
                                    </c:if>
                                    <c:if test="${null != input.travelType && input.travelType == 1}">
                                        <c:if test="${null != map.driver}">
                                            <td style="width: 100px">
                                                <c:if test="${map.driver.status == 0}">
                                                    <div>${map.driver.distance}km</div>
                                                </c:if>
                                                <c:if test="${map.driver.status == 1}">
                                                    <div>${map.driver.status}</div>
                                                </c:if>
                                            </td>
                                            <td style="width: 100px">
                                                <c:if test="${map.driver.status == 0}">
                                                    <div>${map.driver.duration}min</div>
                                                </c:if>
                                                <c:if test="${map.driver.status == 1}">
                                                    <div>${map.driver.message}</div>
                                                </c:if>
                                            </td>
                                        </c:if>
                                        <c:if test="${null == map.driver}">
                                            <td style="width: 100px"></td>
                                            <td style="width: 100px"></td>
                                        </c:if>
                                    </c:if>
                                    <c:if test="${null != input.travelType && input.travelType == 0}">
                                        <c:if test="${null != map.bus}">
                                            <td style="width: 100px">
                                                <c:if test="${map.bus.status == 0}">
                                                    <div>${map.bus.distance}km</div>
                                                </c:if>
                                                <c:if test="${map.bus.status != 0}">
                                                    <div>${map.bus.status}</div>
                                                </c:if>
                                            </td>
                                            <td style="width: 100px">
                                                <c:if test="${map.bus.status == 0}">
                                                    <div>${map.bus.duration}min</div>
                                                </c:if>
                                                <c:if test="${map.bus.status != 0}">
                                                    <div>${map.bus.message}</div>
                                                </c:if>
                                            </td>
                                        </c:if>
                                        <c:if test="${null == map.bus}">
                                            <td style="width: 100px"></td>
                                            <td style="width: 100px"></td>
                                        </c:if>
                                    </c:if>
                                </tr>
                            </c:forEach>
                        </c:forEach>
                        </tbody>
                    </table>
                    <c:if test="${page.totalCount == 0}">
                        <div class="f16 tc mt15">还没有数据</div>
                    </c:if>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });

        layui.use(['form', 'element'], function () {
            var element = layui.element;

            element.on('tab', function (data) {
                $('input[name=type]').val($(this).data('type'));
                submitFunction('#myForm');
            });
        });

    })


</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '路线列表',
            href: '${ctx}/member/route/list.do'
        }, {
            name: '查看路程时间',
            curr: true
        }],
        btns: [{
            name: '返回',
            href: '${ctx}/member/route/list.do',
            icon: 'back'
        }]
    });
</script>
</body>
</html>